View Javadoc

1   // System.java, created Fri Apr  5 18:36:41 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.ClassLib.sun14_win32.java.lang;
5   
6   import joeq.Class.PrimordialClassLoader;
7   
8   /*
9    * @author  John Whaley <jwhaley@alum.mit.edu>
10   * @version $Id: System.java 1456 2004-03-09 22:01:46Z jwhaley $
11   */
12  public abstract class System {
13      
14      private static java.util.Properties props;
15      private static native void setIn0(java.io.InputStream in);
16      private static native void setOut0(java.io.PrintStream out);
17      private static native void setErr0(java.io.PrintStream err);
18  
19      public static java.lang.String mapLibraryName(java.lang.String libname) {
20          return libname; // TODO.
21      }
22  
23      /****
24      public static void initializeSystemClass() {
25          props = new java.util.Properties();
26          initProperties(props);
27          sun.misc.Version.init();
28          java.io.FileInputStream fdIn = new java.io.FileInputStream(java.io.FileDescriptor.in);
29          java.io.FileOutputStream fdOut = new java.io.FileOutputStream(java.io.FileDescriptor.out);
30          java.io.FileOutputStream fdErr = new java.io.FileOutputStream(java.io.FileDescriptor.err);
31          setIn0(new java.io.BufferedInputStream(fdIn));
32          setOut0(new java.io.PrintStream(new java.io.BufferedOutputStream(fdOut, 128), true));
33          setErr0(new java.io.PrintStream(new java.io.BufferedOutputStream(fdErr, 128), true));
34  
35          //try {
36          //    java.util.logging.LogManager.getLogManager().readConfiguration();
37          //} catch (java.lang.Exception ex) {
38          //}
39  
40          //loadLibrary("zip");
41  
42          //sun.misc.VM.booted();
43      }
44      ***/
45      public static void loadLibrary(String libname) {
46          if (libname.equals("zip")) return;
47          Runtime.getRuntime().loadLibrary0(getCallerClass(), libname);
48      }
49      static native Class getCallerClass();
50  
51      private static java.util.Properties initProperties(java.util.Properties props) {
52          // TODO: read these properties from environment.
53          props.setProperty("java.class.version", "48.0");
54          props.setProperty("java.home", "C://jdk1.4.0//jre");
55          props.setProperty("java.runtime.name", "Java(TM) 2 Runtime Environment, Standard Edition");
56          props.setProperty("java.runtime.version", "1.4.0");
57          props.setProperty("java.specification.name", "Java Platform API Specification");
58          props.setProperty("java.specification.vendor", "Sun Microsystems, Inc.");
59          props.setProperty("java.specification.version", "1.4");
60          props.setProperty("java.vendor", "joeq");
61          props.setProperty("java.vendor.url", "http://joeq.sourceforge.net");
62          props.setProperty("java.vendor.url.bug", "http://joeq.sourceforge.net");
63          props.setProperty("java.version", "1.4.0");
64          props.setProperty("java.vm.name", "joeq virtual machine");
65          props.setProperty("java.vm.specification.name", "Java Virtual Machine Specification");
66          props.setProperty("java.vm.specification.vendor", "Sun Microsystems, Inc.");
67          props.setProperty("java.vm.specification.version", "1.0");
68          props.setProperty("java.vm.vendor", "joeq");
69          props.setProperty("java.vm.version", "1.4.0");
70          props.setProperty("java.util.prefs.PreferencesFactory", "java.util.prefs.WindowsPreferencesFactory");
71          
72          props.setProperty("os.arch", "x86");
73          props.setProperty("os.name", "Windows 2000");
74          props.setProperty("os.version", "5.0");
75          
76          props.setProperty("file.encoding", "Cp1252");
77          props.setProperty("file.encoding.pkg", "sun.io");
78          props.setProperty("file.separator", "//");
79          
80          props.setProperty("line.separator", "\r\n");
81          
82          props.setProperty("path.separator", ";");
83          
84          props.setProperty("user.country", "US");
85          props.setProperty("user.dir", "C://joeq");
86          props.setProperty("user.home", "C://Documents and Settings//John Whaley");
87          props.setProperty("user.language", "en");
88          props.setProperty("user.name", "jwhaley");
89          props.setProperty("user.timezone", "");
90  
91          // must be at end: classpathToString() uses some properties from above.
92          props.setProperty("java.class.path", PrimordialClassLoader.loader.classpathToString());
93  
94          return props;
95      }
96      
97  }